<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!--<jsp:useBean id="processing" class="model.BookDetailsDTO" scope="request" /> -->
<!--<jsp:useBean id="user" class="model.UserDTO" scope="request" /> -->

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">

	$(document).ready(function(){
		$('input[type=submit]').attr('disabled', 'disabled');
		$('input').change(function(){
			var radio=$('input:radio[name=status]:checked').val();
			if(radio=='Approve'){
				$('input[type=submit]').removeAttr('disabled');
			}else if(radio=='Reject'){
				$('#comment').keyup(function(){
					if ($.trim($("#comment").val())) {
						$('input[type=submit]').removeAttr('disabled');
					}
					else{
						$('input[type=submit]').attr('disabled', 'disabled');
					}
				});
			}
			
		});
	});
 </script>
<fmt:setBundle basename="Messages_en" />
<title><fmt:message key="title.approvebooking"/></title>
</head>
<body>
<%@ include file="header.jsp" %>
<table>
<tr>
<td width=15%></td>
<td class="menuborder" width=25%>
<table id="content">
			<tr>
				<td><h2 id="header">MENU</h2></td>
			</tr>
			<tr>
				<td><a href="MakeABooking.jsp">Make a Booking</a></td>
			</tr>
			<tr>
				<td><a href="BookDetailsController">View Booking Details</a></td>
			</tr>
			<tr>
				<td><a href="BookingHistoryController">View Booking History</a></td>
			</tr>
			<tr>
				<td><a href="ReviewController">Review Booking</a></td>
			</tr>
			<tr>
				<td><a href="Login.jsp">Sign Out</a>
				</td>
			</tr>
		</table>
</td>
<td width=5%></td>
<td class="contentbody" width=45%>
	<table border="1" align="center" cellpadding="8" cellspacing="0">
		<tr align="left">
			<td><fmt:message key="label.Booking.bookId"/>:</td>
			<td><jsp:getProperty name="processing" property="bookingID" /></td>
		</tr>
		<tr align="left">
			<td><fmt:message key="label.Booking.bookedby"/>:</td>
			<td><jsp:getProperty name="user" property="username" /></td>
		</tr>
		<tr align="left">
			<td><fmt:message key="label.Booking.facilityname"/>:</td>
			<td><jsp:getProperty name="processing" property="facilityName" /></td>
		</tr>
		<tr align="left">
			<td><fmt:message key="label.Booking.fromDate"/>:</td>
			<td><jsp:getProperty name="processing" property="fromDate" /></td>
		</tr>
		<tr align="left">
			<td><fmt:message key="label.Booking.toDate"/>:</td>
			<td><jsp:getProperty name="processing" property="toDate" /></td>
		</tr>
		<tr align="left">
			<td><fmt:message key="label.Booking.reason"/>:</td>
			<td><jsp:getProperty name="processing" property="reason" /></td>
		</tr>
	</table>
	<p><hr>
	<form method="post" name="decision" action="<c:url value='/ApproveController' />">
		<input type="hidden" name="id" value="<jsp:getProperty name='processing' property='bookingID' />">
		<table border="0" align="center" cellpadding="15" cellspacing="0">
			<tr>
				<td colspan="2" align="center">
					<input type="radio" name="status" value="Approve"><fmt:message key="label.button.approve"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" name="status" value="Reject"><fmt:message key="label.button.reject"/></td>
			</tr>
			<tr>
				<td align="left" valign="top"><fmt:message key="label.Booking.comments"/>: </td>
				<td align="left"><textarea id="comment" maxlength="100" rows="4" cols="40"></textarea></td>
			<tr>
				<td colspan="2" align="center"><input type="submit"></td>
		</table>
	</form>
</td>
<td width=10%></td>
</tr>
</table>
<%@ include file="footer.jsp" %>
</body>
</html>